package com.scvtc.controller.teacher;

import com.scvtc.domain.ResResult;
import com.scvtc.domain.entity.teacher.TeacherAttendance;
import com.scvtc.domain.vo.PageVo;
import com.scvtc.domain.vo.teacher.attendance.TeacherAttendanceVo;
import com.scvtc.service.teacher.TeacherAttendanceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "教师考勤管理(TeacherAttendance)")
@RestController
@RequestMapping("teacherAttendance")
public class TeacherAttendanceController {
    //教师考勤管理的 service
    @Autowired
    TeacherAttendanceService teacherAttendanceService;

    @GetMapping("/list")
    @ApiOperation("查询教师考勤管理")
    public ResResult<PageVo<List<TeacherAttendanceVo>>> getAllTeacherSocialService(
            @RequestParam(defaultValue = "1") Long current,
            @RequestParam(defaultValue = "10") Long size,
            TeacherAttendance teacherAttendanceDto) {
        return teacherAttendanceService.getAllTeacherAttendance(current, size, teacherAttendanceDto);
    }

    @PostMapping("/")
    @ApiOperation("添加单个教师服务")
    public ResResult<?> addTeacherAttendance(@RequestBody TeacherAttendance teacherAttendanceDto) {
        return teacherAttendanceService.addTeacherAttendance(teacherAttendanceDto);
    }

    @PutMapping("/")
    @ApiOperation("修改单个教师考勤管理")
    public ResResult<?> updateTeacherAttendance(@RequestBody TeacherAttendance teacherBaseDto) {
        return teacherAttendanceService.updateAttendance(teacherBaseDto);
    }

    @DeleteMapping("/")
    @ApiOperation("删除一条教师服务信息")
    public ResResult<?> deleteTeacherAttendance(Long id) {
        return teacherAttendanceService.deleteAttendance(id);
    }

    @DeleteMapping("/multiple")
    @ApiOperation("删除多条教师服务信息")
    public ResResult<?> deleteMultipleTeacherAttendance(Long[] ids) {
        return teacherAttendanceService.deleteMultipleAttendance(ids);
    }

}
